﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demos.DesignPatterns._23_访问者模式
{
    /// <summary>
    /// 打折商品
    /// </summary>
    public class DiscountedProduct: MyProduct
    {
        /// <summary>
        /// 产品名称
        /// </summary>
        public string Name { get; }
        /// <summary>
        /// 原价
        /// </summary>
        public decimal OriginalPrice { get; }
        /// <summary>
        /// 折扣价
        /// </summary>
        public decimal DiscountedPrice { get; }
        /// <summary>
        /// 数量
        /// </summary>
        public int Quantity { get; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="name">产品名称</param>
        /// <param name="originalPrice">原价</param>
        /// <param name="discountedPrice">折扣价</param>
        /// <param name="quantity">数量</param>
        public DiscountedProduct(string name, decimal originalPrice, decimal discountedPrice, int quantity)
        {
            Name = name;
            OriginalPrice = originalPrice;
            DiscountedPrice = discountedPrice;
            Quantity = quantity;
        }
        /// <summary>
        /// 接受访问者
        /// </summary>
        /// <param name="visitor"></param>
        public void Accept(IVisitor visitor)
        {
            visitor.Visit(this);
        }
         
    }
}
